package com.leanin.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.leanin.domain.FormType;
import com.leanin.response.DataOutResponse;
import com.leanin.service.FormTypeService;

/**
 * 表单类型的Controller
 * @author Administrator
 *
 */
@RestController
@RequestMapping("type")
public class FormTypeController {

	@Autowired
	private FormTypeService formTypeService;
	
	@GetMapping("findTypeList")
	public DataOutResponse findTypeList(@RequestParam Integer type) {
		return formTypeService.findTypeList(type);
	}
	
	
	@PostMapping("addFormType")
	public DataOutResponse addFormType(@RequestBody FormType formType) {
		return formTypeService.addFormType(formType);
	}
	
	@GetMapping("logoutFormType")
	public DataOutResponse logoutFormType(@RequestParam Long typeId) {
		return formTypeService.updateTypeStatus(typeId);
	}
	
	@PostMapping("updateFormType")
	public DataOutResponse updateFormType(@RequestBody FormType formType) {
		return formTypeService.updateFormType(formType);
	}
}
